/**
 * Human ship
 */

import { Feature, Glyph } from '$lib/components';
import { generateMap3 } from '$lib/mapbuilder';
import { defineComponent } from '$lib/ecs';

export const Surface = defineComponent('Surface', {});

const shipMap = `
  =======
 =.......=
=........=
 =.......=
  =======
`;

const shipBorder = (glyph: string) => {
  return [
    [Feature],
    [Glyph, {
      glyph,
      color: '#377',
      background: '#134',
    }],
    [Surface],
  ];
};

const shipDeck = shipBorder;

export const deployShip = (world, x0, y0, z0) => {
  generateMap3(world, shipMap, undefined, x0, y0, z0, {
    '=': shipBorder('='),
    '.': shipDeck('.'),
  });
};
